package com.example.studydemo.customview

import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.util.AttributeSet
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.example.studydemo.R

class TagView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : TextView(context, attrs, defStyleAttr) {
    init {
        textSize=24f
    }

    private val solidPaint = Paint().apply {
        color = ContextCompat.getColor(context, R.color.purple_700)
        style = Paint.Style.STROKE
        strokeWidth=10f
    }

    override fun onDraw(canvas: Canvas?) {
        canvas?.drawRoundRect(0f,0f, width.toFloat(),
                height.toFloat(), (height/4).toFloat(), (height/4).toFloat(),solidPaint)
        super.onDraw(canvas)
    }
}